<template>
  <view class="page">
    <view class="input">
      <view class="input-wrapper" @click="dateShow = true">
        <view class="input-label">农事操作时间</view>
        <view class="input-put">{{
          $dayjs(date).format("YYYY-MM-DD HH:mm")
        }}</view>
        <image
          class="input-icon"
          :src="require('@/static/img/arrows-right.png')"
          mode="scaleToFill"
        />
      </view>
    </view>
    <view class="input">
      <view class="input-wrapper" @click="columnsShow = true">
        <view class="input-label">当日天气</view>
        <view class="input-put"
          >{{ array2[1][index2[1]] }} {{ array2[0][index2[0]] }}
        </view>
        <image
          class="input-icon"
          :src="require('@/static/img/arrows-right.png')"
          mode="scaleToFill"
        />
      </view>
    </view>
    <!-- 选择器 -->
    <view class="input">
      <view class="input-wrapper" @click="pickerShow = true">
        <view class="input-label">物候期</view>
        <view class="input-put">{{ array[0][index] }}</view>
        <image
          class="input-icon"
          :src="require('@/static/img/arrows-right.png')"
          mode="scaleToFill"
        />
      </view>
    </view>
    <view class="main">
      <view class="add-item">
        <view class="add-item-title">
          <u-icon name="minus" color="#999"></u-icon>
          <view style="margin: 0 30rpx">病虫害防治</view>
          <u-icon name="minus" color="#999"></u-icon>
        </view>
        <view class="add-item-tags">
          <view
            class="add-item-tags-item"
            @click="gotoPage('/pages/experiment/add-page')"
          >
            <u-icon name="plus" color="#4fb718"></u-icon>
            <view style="margin-left: 15rpx"> 点击选择防治的害虫病</view>
          </view>
        </view>
      </view>
      <view class="add-item">
        <view class="add-item-title">
          <u-icon name="minus" color="#999"></u-icon>
          <view style="margin: 0 30rpx">植物营养</view>
          <u-icon name="minus" color="#999"></u-icon>
        </view>
        <view class="add-item-tags">
          <view class="add-item-tags-item">
            <u-icon name="plus" color="#4fb718"></u-icon>
            <view style="margin-left: 15rpx"> 点击选择植物营养目的</view>
          </view>
        </view>
      </view>
      <view class="add-item">
        <view class="add-item-title">
          <u-icon name="minus" color="#999"></u-icon>
          <view style="margin: 0 30rpx">草害</view>
          <u-icon name="minus" color="#999"></u-icon>
        </view>
        <view class="add-item-tags">
          <view class="add-item-tags-item">
            <u-icon name="plus" color="#4fb718"></u-icon>
            <view style="margin-left: 15rpx">点击选择防治的草害</view>
          </view>
        </view>
      </view>
    </view>
    <view class="btn-box">
      <button class="btn" @click="onSubmit">
        <text class="btn-text" style="color: #fff">保存</text>
      </button>
    </view>
    <!-- 日期 -->
    <u-datetime-picker
      :show="dateShow"
      v-model="date"
      mode="datetime"
      @cancel="dateShow = false"
      @confirm="bindDateChange"
    ></u-datetime-picker>
    <!-- 天气 -->
    <u-picker
      :show="columnsShow"
      ref="uPicker"
      :columns="array2"
      @cancel="columnsShow = false"
      @confirm="bindPickerChange2"
    ></u-picker>
    <!-- 物候期 -->
    <u-picker
      :show="pickerShow"
      :columns="array"
      @cancel="pickerShow = false"
      @confirm="bindPickerChange"
    ></u-picker>
  </view>
</template>

<script>
import common from "./common";
import uUpload from "@/components/upload.vue";
export default {
  mixins: [common],
  components: {
    uUpload,
  },
  data() {
    return {
      operatTags: [
        { name: "施肥施肥是", change: false },
        { name: "除草", change: false },
        { name: "灌溉", change: false },
        { name: "喷药", change: false },
        { name: "采摘", change: false },
        { name: "其他", change: false },
        { name: "施肥施肥", change: false },
        { name: "除草", change: false },
        { name: "灌溉", change: false },
        { name: "喷药", change: false },
        { name: "采摘", change: false },
      ],
      fileList1: [],
    };
  },
  onLoad() {},
  mounted() {},
  methods: {
    gotoPage(value) {
      this.$u.route({
        url: value,
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.page {
  padding-top: 20rpx;
  min-height: 100vh;
  background: #f6f6f6;
  padding-bottom: 150rpx;
}
.input {
  background: #fff;
  padding: 0 30rpx;

  &-wrapper {
    display: flex;
    align-items: center;
    border-bottom: 2rpx solid #e9e9e9;
    padding: 20rpx 0;
  }
  &-label {
    font-weight: bold;
    font-size: 26rpx;
    color: #202020;
  }
  &-put {
    flex: 1;
    font-size: 24rpx;
    text-align: right;
    color: #999999;
  }
  &-icon {
    width: 21rpx;
    height: 21rpx;
    margin-left: 5rpx;
  }
}
.main {
  margin-top: 20rpx;
  padding: 20rpx 30rpx;
  box-sizing: border-box;
  .add-item {
    width: 100%;
    border-radius: 10rpx;
    background-color: #fff;
    padding: 35rpx 0;
    margin-bottom: 20rpx;
    &-title {
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 26rpx;
      margin-bottom: 30rpx;
    }
    &-tags {
      display: flex;
      justify-content: center;
      &-item {
        padding: 15rpx 20rpx;
        border-radius: 11rpx 11rpx 11rpx 11rpx;
        border: 2rpx solid #4fb718;
        font-size: 25rpx;
        color: #4fb718;
        display: flex;
        justify-content: center;
        align-items: center;
      }
    }
  }
}
.btn-box {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 100%;
  // position: absolute;
  // bottom: 108rpx;
}
.btn {
  width: 100%;
  background: #4fb718;
  border-radius: 0rpx;
  margin: 0 auto;
  &-text {
    font-size: 32rpx;
    font-weight: 400;
    color: #ffffff;
  }
}
</style>
